package com.ncs.base.task.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ncs.base.task.dao.slave.UserSalveDao;
import com.ncs.base.task.entity.UserMasterEntity;
import com.ncs.base.task.entity.UserSalveEntity;
import com.ncs.base.task.service.UserSalveService;

import ch.qos.logback.core.joran.util.beans.BeanUtil;

@Service("userSalveService")
public class UserSalveServiceImpl extends ServiceImpl<UserSalveDao, UserSalveEntity> implements UserSalveService{
	
     
	@Autowired
	private UserSalveDao userSalveDao;
	@Override
	@DS("slave")
	public void updateUserSalve(UserSalveEntity updateWrapper) {
		
		//System.out.println(update);
		
	}

	@Override
	@DS("slave")
	public void SaveUserMasterList(List<UserMasterEntity> getuser,String table) {
		// TODO Auto-generated method stub
		for (UserMasterEntity userMasterEntity : getuser) {
			UserSalveEntity userSalveEntity = new UserSalveEntity();
			BeanUtils.copyProperties(userMasterEntity, userSalveEntity);
			userSalveEntity.setTableName(table);
			userSalveDao.insertSelective(userSalveEntity);
		}
	}

}
